package com.yh.correct.controller;

import java.util.HashMap;
import java.util.Map;

import org.jboss.logging.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.ModelAndView;

import com.yh.correct.service.impl.EchartsServiceImpl;

/**
 * 作者:王登科
 * 创建时间:2017-03-13
 * 描述:矫正人员报表控制层
 */
@RestController
@RequestMapping(value="/echarts")
public class EchartsController {
	/**
	 * logger4j日志
	 */
	private static Logger logger=Logger.getLogger(EchartsController.class);
	/**
	 * 自动注入
	 */
	@Autowired
	private EchartsServiceImpl echartsServiceImpl;
	
	@RequestMapping("/showQuarterlyReport")
	public ModelAndView showQuarterlyReport(){
		return new ModelAndView("statisticalReports/quarterlyReports");
	}
	/**
	 *季度报表 
	 */
	@RequestMapping(value="/viewEcharts")
	public Map<String,Object> quarterlyReports(){
		Map<String,Object> map = new HashMap<String,Object>();
		map.put("category", echartsServiceImpl.findMonth());
		map.put("pilot", echartsServiceImpl.findPilotCount()); 
		map.put("socialWorkers", echartsServiceImpl.findSocialWorkers());
		map.put("governmentWorkers", echartsServiceImpl.findGovernmentWorkers() );
		map.put("successfulCorrection", echartsServiceImpl.findSuccessfulCorrection());
		map.put("name", echartsServiceImpl.findName());
		return map;
	}
	/**
	 * 进入月度首页 
	 */
	@RequestMapping("/showMonthlyReport")
	public ModelAndView showMonthlyReport(){
		return new ModelAndView("statisticalReports/monthlyReports");
	}
	
	/**
	 * 月度报表
	 */
	@RequestMapping(value="/view")
	public Map<String,Object> monthlyReport(){
		Map<String,Object> map = new HashMap<String,Object>();
		map.put("name", echartsServiceImpl.findProperties() );
		map.put("value", echartsServiceImpl.findAllCount());
		return map;
	}
	
}
